package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.view.RegisterActivity;

/**
 * author : 许建宏
 * Date: 2017/10/20 0020
 * View:注册
 */

public class PostRegisterPresenter {

    private RequestModel requestModel;
    private RegisterActivity registerActivity;

    public PostRegisterPresenter(RegisterActivity registerActivity){
        this.requestModel=new RequestModel();
        this.registerActivity=registerActivity;
    }

    public void LoginPresenterOperation(final String name, final String pwd){

        requestModel.PostRegister(name, pwd, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                registerActivity.onSuccess(data);
            }

            @Override
            public void onError(String msg) {
                registerActivity.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                registerActivity.onRefreshUI();
            }
        });
    }
}
